package com.giteelou.antlr.ps.man;

import com.giteelou.antlr.ps.man.symbol.Symbol;
import com.giteelou.antlr.ps.man.symbol.Variable;
import com.giteelou.antlr.ps.man.type.Type;
import org.antlr.v4.runtime.tree.ParseTree;

import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;

/**
 * 保存语义解析数据
 */
public class Semantics {

    /**
     * AST
     */
    protected ParseTree ast;
    /**
     * AST节点, Symbol
     */
    protected Map<ParseTree, Symbol> nodeSymbols = new HashMap<>();
    /**
     * AST节点, Type
     */
    protected Map<ParseTree, Type> nodeTypes = new HashMap<>();
    /**
     * variable名称, Variable
     */
    protected Map<String, Variable> variables = new HashMap<>();

    /**
     * 错误日志
     */
    protected List<String> errors = new LinkedList<>();

}
